1. Technical Field
The embodiments herein generally relate to image compression, and, more particularly, to an optimized prediction based engine for image compression.
2. Description of the Related Art
Image compression is the application of data compression on digital images to reduce redundancy of image data in order to be able to store or transmit data in an efficient form. Image compression can be either lossy or lossless. In lossless image compression, all data from an original file is preserved. Lossy compression involves removing some data from the original file and saving the image with a reduced file size. JPEG (Joint Photographic Experts Group) is a commonly used standard for lossy compression of photographic images.
The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. The image is composed of two components. The first component Y represents the brightness or the black and white component. I and Q represent the second component, which is the chrominance or color component. The image is divided into blocks that are 8×8 pixels in size. The pixel is the smallest image component or image unit. In the JPEG compression technique, each image undergoes the steps of Discrete Cosine Transform (DCT), Quantization, Zigzag scan, Differential Pulse Code Modulation (DPCM), Run Length Coding (RLC), and Entropy Coding.
FIG. 1 illustrates a Zigzag scan on an 8×8 block that maps the block to a 1×64 vector composed of a DC component 102 and 63 AC components 104. The DC component 102 has a zero frequency whereas the AC component 104 has nonzero frequencies. The value in the location F[0,0] of the transformed matrix is called the DC coefficient and is the average of all 64 values in the matrix. The other 63 values are called AC coefficients and have a frequency coefficient associated with them. Spatial frequency coefficients increase as one moves from left to right (horizontally) or from top to bottom (vertically). Low spatial frequencies are clustered in the left top corner.
FIG. 2 illustrates a block diagram of operations of a JPEG compression technique applied on an image 202 divided into blocks of 8×8 pixels in size having a black and white component 204 and a chrominance component 206; the JPEG compression technique including a Discrete Cosine Transform (DCT) operation 208, a Quantization operation 210, a Zigzag scan operation 212, a Differential Pulse Code Modulation (DPCM) operation 214, a Run Length Coding (RLE) operation 216, and a Huffman coding operation 218. The DCT operation 208 transforms the image 202 from a spatial domain to a frequency domain by transforming it into DCT coefficients in the frequency domain.
The Quantization operation 210 removes perceptually less significant data to reduce the number of bits per DCT coefficient. The Quantization operation 210 is based on the observation that psychophysical experiments suggest that humans are much less likely to notice the loss of very high spatial frequency components compared to the loss of lower frequency components. The DCT coefficients are divided by a constant N and rounded off to the nearest integer. In JPEG, each DCT F[u,v] is divided by a constant q(u,v). The table of q(u,v) is called quantization table. Q(u, v) tends to have larger values towards the lower right corner. This aims to introduce more loss at the higher spatial frequencies, which are less likely to be detected by humans.
The Zigzag scan operation 212 maps the block to a 1×64 vector composed of a DC component 102 and an AC component 104. The Zigzag pattern groups low frequency coefficients in the top of the vector. In the DPCM operation 214, the DC component 102 is encoded by DPCM using the difference from previous 8×8 blocks. Since the DC component 102 is large and varied but often close to previous values, the DC component 102 is not sent. Instead, only the difference from the previous one is sent. This is known as a DC intra frame technique or an inter block prediction technique. In the RLE operation 216, the AC component 104 is encoded by a simple compression RLC. There are 63 values of the AC coefficients, among which are long strings of zeros due to the Zigzag scan.
Each AC coefficient encoded as a pair of values includes a skip and a value. The skip indicates the number of zeros in the run and the value is the next non-zero coefficient. In the Huffman coding operation 218, the DC component 102 and the AC component 104 are represented by a smaller number of bits such as code words. A prefix property of the Huffman code words enables decoding of the encoded bit stream unambiguously. The JPEG standards uses a prediction technique based on intra frame or inter blocks. In order to decode the DC component of a new 8×8 block, a previously decoded 8×8 block DC component is used. Limiting prediction to DC components only, leads to low compression efficiency. Thus, there is a need for an improved technique for prediction based image compression with improved compression efficiency.